Prepare DrFed for collaborative development#14
Conversation
- New @drfed/models package with Drizzle ORM schema defining accounts, instances, and instance_members tables (PostgreSQL), with support for both PGlite (local file-based) and PostgreSQL backends, plus database/transaction type definitions and an initial migration - New @drfed/drfed package: main server CLI using srvx and GraphQL Yoga, with @optique-based argument parsing for database backend selection (--pglite-data-path or --postgres-url), listen address (--listen), and migration control (--no-migrate) - Expanded @drfed/graphql with a Pothos SchemaBuilder integrated with the Drizzle plugin for type-safe GraphQL schema generation, and a createYogaServer() factory function wiring it all together - Added .oxfmtrc.json formatter config and .zed/settings.json with per-language format-on-save via oxfmt - Updated mise.toml and pnpm workspace to include the new packages
- Add @pothos/plugin-relay and graphql-scalars dependencies - Add DateTime, Email, UUID custom scalar types to the schema builder - Rename PothosTypes to SchemaTypes and add Scalars definition - Implement Account drizzleNode with UUID, email, created fields - Add accountByUuid query field - Refactor Instance to drizzleNode with slug, expires, created fields - Add normalizeEmail() utility function to @drfed/models - Export normalizeEmail from @drfed/models package index
Replace the Nushell-based dev task with a Node.js/TypeScript script (scripts/dev.mts) that provides more robust process management: - Remove dist directories before starting builds - Spawn tsdown in watch mode across all packages - Poll until all packages have built their dist directories - Start the drfed server once builds are ready - Propagate SIGINT/SIGTERM gracefully to child process groups, with a 5-second timeout before force-killing - Handle double Ctrl+C with an immediate forced kill - Cross-platform support (Windows taskkill, Unix process groups) Also handle SIGINT (in addition to SIGTERM) in the server's main() to ensure clean shutdown when running under node --watch. Assisted-by: Codex:gpt-5.5
Document the DrFed development workflow, including mise-based tasks, package boundaries, AGPL source headers, npm packaging expectations, and AI usage disclosure rules. Point AGENTS.md and CLAUDE.md at the same guide, and exclude those symlinks from Hongdown so Markdown checks validate the source document once. Assisted-by: Codex:gpt-5.5
Add package-level tsconfig files with strict no-emit type checking and allowImportingTsExtensions enabled for local .ts imports. Wire Node 26 types through the pnpm catalog, add the mise type check, and update imports that must be type-only under verbatimModuleSyntax. Also fix the development script's child-process error result typing and process lookup error handling so it passes the stricter checks.
2chanhaeng
left a comment
There was a problem hiding this comment.
Looks great! The code and the flow seem solid. I think it would be even better if more documentation for the code were added.
- CONTRIBUTING.md: descriptions for each package
- README.md for each package
@drfed/models: descriptions for each model and their relationships@drfed/graphql: descriptions for each node
Added a concise README.md to each of the three packages: - packages/drfed/README.md: documents the CLI options, server startup behavior, and source file layout for @drfed/drfed. - packages/graphql/README.md: documents the custom scalars, source layout, and createYogaServer usage for @drfed/graphql. - packages/models/README.md: documents the database schema, source layout, and migration generation for @drfed/models. Added a Packages section to CONTRIBUTING.md with a table summarising each package's directory path, npm name, and one-line description. Also added README.md to the files list in each package.json so the documentation is included in published npm packages. Assisted-by: Claude Code:claude-sonnet-4-6
sij411
left a comment
There was a problem hiding this comment.
Could you also change my email in packages to work@kwonjiwon.org ?
| "accounts", | ||
| { | ||
| id: uuid().primaryKey(), | ||
| email: varchar({ length: 255 }).notNull().unique(), |
There was a problem hiding this comment.
I might be misunderstanding something, but since the same email can be used across multiple instances, wouldn't it be non-unique? Also, if for virtual accounts, wouldn't it be more efficient not to have an email at all, so making it nullable would be better?
There was a problem hiding this comment.
I guess you're misunderstanding what this accounts table is for. It represents DrFed accounts who creates instances, not instance actors who belong to an instance.
There was a problem hiding this comment.
Hmm... OK, now that's clear. But then, I can't understand why the name of the relation table between the accounts and the instances is instance_members. I think instance_creator or instance_owner (@sij411's idea) is easier to understand.
Add scripts/check-versions.mts and scripts/bump-versions.mts along with corresponding mise tasks (check:versions and bump) to keep the shared `version` field across all packages/*/package.json in sync. check:versions is wired into the check:* group so it runs as part of `mise run check` and fails when any package diverges, reporting which packages are at which versions. `mise run bump <version>` updates every package's version field at once and prints a summary of the changes. Document the shared-version policy and the new commands in CONTRIBUTING.md under a new "Version management" section, and list the sync check among the checks run by `mise run check`. fedify-dev#14 (comment) Assisted-by: OpenCode:glm-5.2
Prepare DrFed for collaborative development
|
Rebased by mistaken; replace commits with merge commit d2141f9. |
This pull request sets up the project so other contributors can work against the same local workflow, package boundaries, and contribution rules.
It adds the first installable server and model packages, wires the GraphQL layer to the database schema, and gives contributors a documented path for building, running, formatting, and reviewing changes.
What changed
@drfed/models, including the Drizzle schema for accounts, instances, and instance members, database type exports, email normalization, migration support, and the initial generated migration under packages/models/drizzle.@drfed/drfed, the main server package with thedrfed-servernpm binary, Optique-based CLI parsing, PGlite and PostgreSQL database options, automatic migration support, and GraphQL Yoga serving throughsrvx.@drfed/graphqlwith a Pothos schema builder, Drizzle integration, Relay node support,DateTime,Email, andUUIDscalars, Account and Instance object types, and anaccountByUuidquery.tsdown --watchbuilds, waits for the packages to build, starts the server, and handles shutdown more reliably.Checks
mise run checkmise run buildAI disclosure
scripts/dev.mts and CONTRIBUTING.md were written with GPT-5.5 assistance. The README.md file in each package was written with Claude Sonnet 4.6. assistance. The scripts/bump-versions.mts and scripts/check-versions.mts were written with GLM-5.2 assistance. No AI assistance was used for the other changes in this pull request.